package com.bd.module;

import java.awt.Font;
import java.awt.Toolkit;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;

public class MainPanl extends JPanel {
	private static final long serialVersionUID = 1L;
	/** 获得当前屏幕分辨率宽度 */
	private double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
	/** 获得当前屏幕分辨率高度 */
	private double height = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
	/** button的高度 */
	private int btnHeight = 30;
	private int btnWidth = 190;
	/**按钮字体*/
	private final Font BTN_FONT = new Font("楷体", Font.PLAIN, 20);
	/**panel title字体大小*/
	private final Font Pane_FONT = new Font("楷体", Font.PLAIN, 20);
	/** 主功能界面(按钮依次:收货,退货,查询,修改密码,过货,返回) */
	private JButton saleBtn, refundBtn, queryBtn, changPwdBtn, postGodBtn,returnBtn;

	public MainPanl() {
		this.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\u4E3B\u529F\u80FD\u754C\u9762", TitledBorder.CENTER, TitledBorder.TOP, Pane_FONT, null));
		this.setLayout(null);
		// 根据屏幕大小绘制主功能界面内容位置
		saleBtn = new JButton("销售(Alt+S)");
		saleBtn.setBounds((int) (width / 3 - 1),(int) (height / 4 - btnHeight), btnWidth, btnHeight);
		this.add(saleBtn);
		saleBtn.setFont(BTN_FONT);

		refundBtn = new JButton("退货(Alt+T)");
		refundBtn.setBounds((int) (width * 2 / 3 - 1),(int) (height / 4 - btnHeight), btnWidth, btnHeight);
		this.add(refundBtn);
		refundBtn.setFont(BTN_FONT);

		queryBtn = new JButton("查询(Alt+Q)");
		queryBtn.setBounds((int) (width / 3 - 1),(int) (height / 2 - btnHeight), btnWidth, btnHeight);
		this.add(queryBtn);
		queryBtn.setFont(BTN_FONT);

		changPwdBtn = new JButton("修改密码(Alt+M)");
		changPwdBtn.setBounds((int) (width * 2 / 3 - 1),(int) (height / 2 - btnHeight), btnWidth, btnHeight);
		this.add(changPwdBtn);
		changPwdBtn.setFont(BTN_FONT);

		postGodBtn = new JButton("过货(Alt+P)");
		postGodBtn.setBounds((int) (width / 3 - 1),(int) (height * 3 / 4 - btnHeight), btnWidth, btnHeight);
		this.add(postGodBtn);
		postGodBtn.setFont(BTN_FONT);
		
		returnBtn = new JButton("返回(Alt+R)");
		returnBtn.setBounds((int) (width * 2 / 3 - 1),(int) (height * 3 / 4 - btnHeight), btnWidth, btnHeight);
		this.add(returnBtn);
		returnBtn.setFont(BTN_FONT);
	}
}
